package com.credithc.fastdfs.monitor.service.impl;

import java.util.List;

import org.csource.common.MyException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.credithc.fastdfs.api.entity.Alarm;
import com.credithc.fastdfs.api.mapper.AlarmMapper;
import com.credithc.fastdfs.monitor.service.AlarmService;
import com.credithc.framework.core.mybatis.page.PageController;
@Service("alarmServiceImpl")
public class AlarmServiceImpl implements AlarmService {
	
	@Autowired
	private AlarmMapper alarmMapper;

	@Override
	public PageController selectAlarmList(PageController page, Alarm alarm) {
		List<Alarm> list = alarmMapper.selectAlarmList(page, alarm);
		page.setContent(list);
		return page;
	}

	@Override
	public int addAlarm(Alarm alarm) throws MyException {
		return alarmMapper.addAlarm(alarm);
	}

	@Override
	public Alarm getAlarmBySysId(String alarmId) throws MyException {
		return alarmMapper.getAlarmBySysId(alarmId);
	}

	@Override
	public int editAlarm(Alarm alarm) throws MyException {
		return alarmMapper.editAlarm(alarm);
	}

	@Override
	public int delAlarm(List<String> alarmId) throws MyException {
		for(String id : alarmId) {
			alarmMapper.delAlarm(id);
		}
		return 1;
	}

}
